package com.youchuang.action.admin;

import javax.annotation.Resource;

import org.apache.log4j.Logger;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;

import com.youchuang.action.BaseAction;
import com.youchuang.common.Constant;
import com.youchuang.service.AdminService;

/**
 * 管理员删除图书信息
 * 
 * @author Administrator
 *
 */
@Namespace(value = "/admin")
@ParentPackage("shopping-default")
public class ProductDelectAction extends BaseAction {
	private static final Logger logger = Logger.getLogger(ProductDelectAction.class.getSimpleName());
	private String id;
	@Resource
	private AdminService adminService;

	@Action(value = "productDelect", results = {
			@Result(name = Constant.SUCCESS, type = "json", params = { "root", "resultObj" }) })
	public String execute() throws Exception {
		logger.info("ProductDelectAction is execute");
		adminService.deleteProductById(id);

		return Constant.SUCCESS;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

}
